# -*-coding:utf-8 -*-
from  aip import AipFace
#import tensorflow as tf
from argparse import ArgumentParser
import base64


def main():

    parser = ArgumentParser()
    parser.add_argument( '-i' , dest= 'img_name' , help="import image name, please" )

    args = parser.parse_args()

    APP_ID = "14201637"
    API_KEY = "e4RElqtGGrqOW7Kg7s2XADG6"
    SECRET_KEY = "HxLrXjqSITehRXyDMUdiBCdq3OKUYnVa"

    client = AipFace(APP_ID, API_KEY, SECRET_KEY)

    with open( args.img_name , 'rb' ) as fo:
        web_content = str( base64.b64encode( fo.read() )  , 'utf-8' )


        params = {}
        params['image'] = web_content
        params['image_type'] = "BASE64"
        params['face_field'] = "face_liveness"
        result = client.faceverify( [ params] )
        print( result )

if __name__ == "__main__":
    main()
